package cn.le.runner;

import cn.le.handler.banks.LoginHandler;
import cn.le.handler.banks.SendMsgHandler;
import cn.le.server.NettyServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

@Component
public class ApplicationInit implements ApplicationRunner{
    @Autowired
    private LoginHandler loginHandler;
    @Autowired
    private SendMsgHandler sendMsgHandler;
    @Override
    public void run(ApplicationArguments args) throws Exception {
        new Thread(new Runnable() {
            @Override
            public void run() {
                NettyServer.start(loginHandler,sendMsgHandler);
            }
        }).start();
    }
}
